﻿using Orchard.ContentManagement.Drivers;
using Orchard.Localization;
using Szmyd.Orchard.Modules.Jumpstart.Models;

namespace Szmyd.Orchard.Modules.Jumpstart.Drivers
{
    /// <summary>
    /// Driver for the UnpersistedPart.
    /// Think about drivers as controllers for your parts. They are responsible for UI (display/edit your part).
    /// </summary>
    public class UnpersistedPartDriver : ContentPartDriver<UnpersistedPart>
    {
        public Localizer T { get; set; }

        public UnpersistedPartDriver() {
            T = NullLocalizer.Instance;
        }

        /// <summary>
        /// This method is responsible for displaying your part in the frontend.
        /// </summary>
        /// <param name="part">Your part.</param>
        /// <param name="displayType"></param>
        /// <param name="shapeHelper"></param>
        /// <returns></returns>
        protected override DriverResult Display(UnpersistedPart part, string displayType, dynamic shapeHelper)
        {
            return ContentShape("Parts_Jumpstart_Unpersisted",
                () => shapeHelper.Parts_Jumpstart_Unpersisted(ContentPart: part));
        }

        // There is nothing to edit and update, so we don't need Editor methods.
    }
}